//
//  ViewController.m
//  JKStar
//
//  Created by 王冲 on 2018/4/6.
//  Copyright © 2018年 希爱欧科技有限公司. All rights reserved.
//

#import "ViewController.h"
#import "UIView+JKUiviewExtension.h"
// 展示评分
#import "JKStarDisplayViewController.h"
// 打分
#import "JKStarScoreViewController.h"
@interface ViewController ()

@property(nonatomic,strong) UIButton *button1;
@property(nonatomic,strong) UIButton *button2;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
   
    self.view.backgroundColor = [UIColor whiteColor];
    
    [self.view addSubview:self.button1];
    [self.view addSubview:self.button2];
    
    self.button2.y = CGRectGetMaxY(self.button2.frame)+100;

}

#pragma mark 按钮的点击事件
-(void)click:(UIButton *)sender{
    
    switch (sender.tag) {
        case 101:{
            
            JKStarDisplayViewController *jKStarDisplayViewController = [JKStarDisplayViewController new];
            [self.navigationController pushViewController:jKStarDisplayViewController animated:YES];
        }break;
        case 102:{
            
            JKStarScoreViewController *jKStareScoreViewController = [JKStarScoreViewController new];
            [self.navigationController pushViewController:jKStareScoreViewController animated:YES];
        }break;
            
        default:
            break;
    }
    
    
}

-(UIButton *)button1{
    
    if (!_button1) {
        
        _button1 = [[UIButton alloc]initWithFrame:CGRectMake(100, 150, 100, 50)];
        [_button1 setTitle:@"展示分数" forState:UIControlStateNormal];
        [_button1 addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
        _button1.tag = 101;
        [_button1 setBackgroundColor:[UIColor purpleColor]];
    }
    return _button1;
}

-(UIButton *)button2{
    
    if (!_button2) {
        
        _button2 = [[UIButton alloc]initWithFrame:CGRectMake(100, 200, 100, 50)];
        _button2.tag = 102;
        [_button2 setTitle:@"打分" forState:UIControlStateNormal];
        [_button2 setBackgroundColor:[UIColor brownColor]];
        [_button2 addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _button2;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
   
    
}


@end
